package com.example.job.elasticjob;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.dangdang.elasticjob.lite.annotation.ElasticSimpleJob;
import org.springframework.stereotype.Component;

//Job configuration annotation
@ElasticSimpleJob(cron = "*/3 * * * * ?", shardingTotalCount = 2)
@Component
public class AppJob implements SimpleJob {
    @Override
    public void execute(ShardingContext shardingContext) {
        System.out.println("hello from shard  " + shardingContext.getShardingItem());
    }
}
